package com.yx.fsysserver.file.service;

import com.yx.fsysserver.file.component.Signature;
import org.springframework.stereotype.Service;

import java.util.Random;

@Service
public class TencentPlayService {

    /**
     *
     * @return
     */
    public String getSignature(){
        Signature sign = new Signature();
        sign.setSecretId("AKIDviDdu0GX4SgkcMqqMivypaNG0Zw966qT");
        sign.setSecretKey("azDIE3hz871qZ7TeeFD2gAWijdNyPfkd");
        sign.setCurrentTime(System.currentTimeMillis() / 1000);
        sign.setRandom(new Random().nextInt(Integer.MAX_VALUE));
        sign.setSignValidDuration(3600 * 24 * 2);
        //使用转码模板 10，20 进行转码；转码过程使用水印模板 419468 打水印；使用指定时间点截图模板 10 截取首帧设置封面；
        sign.setProcedure("QCVB_SimpleProcessFile({10,20},419468,10)");

        try {
            String signature = sign.getUploadSignature();
            System.out.println("signature : " + signature);
            return signature;
        } catch (Exception e) {
            System.out.print("获取签名失败");
            e.printStackTrace();
        }
        return "";
    }
}
